package com.kgcx.system.controller;

import com.kgcx.common.bean.RequestData;
import com.kgcx.common.bean.ReturnData;
import com.kgcx.common.controller.BaseController;
import com.kgcx.system.domain.BaseInfo;
import com.kgcx.system.service.BaseInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 吴刚林
 * @date 2017/11/20
 */
@Api(description = "运营公司接口", tags = "运营公司接口")
@RestController
@RequestMapping("baseinfo")
public class BaseInfoController extends BaseController {

    @Autowired
    private BaseInfoService baseInfoService;

    @ApiOperation(value = "新增运营公司", httpMethod = "POST", notes = "这是用来新增运营公司的接口")
    @PostMapping("addBaseInfo")
    public ReturnData<String> addBaseInfo(@RequestBody BaseInfo baseInfo) {
        baseInfoService.addBaseInfo(baseInfo);
        return new ReturnData<>();
    }
    /**
     * 专给监管平台提供查询
     */
    @ApiOperation(value = "查询运营公司", httpMethod = "GET", notes = "这是用来查询运营公司的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "kid", value = "主键ID", required = false, paramType = "query", dataType = "String", dataTypeClass = String.class)
    })
    @GetMapping("getBaseInfo")
    public ReturnData<BaseInfo> getBaseInfo() {
        RequestData requestData = this.getRequestData();
        BaseInfo baseInfo =baseInfoService.getBaseInfo(requestData.getLong("kid"));
        return new ReturnData<>(baseInfo);
    }
}
